package com.player.rest.util;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class ValidationResult {
	private Map<String, Set<String>> messagesByKey = new HashMap<String, Set<String>>();

	public ValidationResult() {
	}

	public void addMessage(String key, String message) {
		Set<String> messages = messagesByKey.get(key);
		if (messages == null) {
			messages = new HashSet<String>();
			messagesByKey.put(key, messages);
		}
		messages.add(message);
	}

	public boolean isValid() {
		return messagesByKey.isEmpty();
	}

	public Map<String, Set<String>> getMessages() {
		return messagesByKey;
	}

	public Set<String> getMessagesForKey(String key) {
		return messagesByKey.get(key);
	}

}
